Test Series - Data Structure

Test Number 51/115

Q: What is the maximum number of children that a binary tree node can have?
A. 0
B. 1
C. 2
D. 3
Solution: In a binary tree, a node can have atmost 2 nodes (i.e.) 0,1 or 2 left and right child.
Q: A binary tree is a rooted tree but not an ordered tree.
A. true
B. false
C. 
D. 
Solution: A binary tree is a rooted tree and also an ordered tree (i.e) every node in a binary tree has at most two children.
Q: How many common operations are performed in a binary tree?
A. 1
B. 2
C. 3
D. 4
Solution: Three common operations are performed in a binary tree- they are insertion, deletion and traversal.
Q: What is the traversal strategy used in the binary tree?
A. depth-first traversal
B. breadth-first traversal
C. random traversal
D. Priority traversal
Solution: Breadth first traversal, also known as level order traversal is the traversal strategy used in a binary tree. It involves visiting all the nodes at a given level.
Q: How many types of insertion are performed in a binary tree?
A. 1
B. 2
C. 3
D. 4
Solution: Two kinds of insertion operation is performed in a binary tree- inserting a leaf node and inserting an internal node.
Q: How many bits would a succinct binary tree occupy?
A. n+O(n)
B. 2n+O(n)
C. n/2
D. n
Solution: A succinct binary tree occupies close to minimum possible space established by lower bounds. A succinct binary tree would occupy 2n+O(n) bits.
Q: The average depth of a binary tree is given as?
A. O(N)
B. O(√N)
C. O(N2)
D. O(log N)
Solution: The average depth of a binary tree is given as O(√N). In case of a binary search tree, it is O(log N).
Q: If binary trees are represented in arrays, what formula can be used to locate a left child, if the node has an index i?
A. 2i+1
B. 2i+2
C. 2i
D. 4i
Solution: If binary trees are represented in arrays, left children are located at indices 2i+1 and right children at 2i+2.
Q: Using what formula can a parent node be located in an array?
A. (i+1)/2
B. (i-1)/2
C.  i/2
D. 2i/2
Solution: If a binary tree is represented in an array, parent nodes are found at indices (i-1)/2.
Q: Which of the following properties are obeyed by all three tree – traversals?
A. Left subtrees are visited before right subtrees
B. Right subtrees are visited before left subtrees
C. Root node is visited before left subtree
D. Root node is visited before right subtree
Solution: In preorder, inorder and postorder traversal the left subtrees are visited before the right subtrees. In Inorder traversal, the Left subtree is visited first then the Root node then the Right subtree. In postorder traversal, the Left subtree is visited first, then Right subtree and then the Root node is visited.

You Have Score    /10